package com.apes.scm.masterdata.finance.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：资金收入类型
 *
 * @Auther: linwz
 * @Date: 2018/8/13 09:26
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = AmtReceipt.CONST_TABLE_NAME)
public class AmtReceipt extends Model {
    public static final String CONST_TABLE_NAME = "mas_amt_receipt";

    @Id
    @Column(name = "id", length = 3)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "收入编码",padding = 3)
    @Comment("收入编码")
    private String id;  //收入编码

    @Column(name = "name", nullable = false, length = 64)
    @Comment("收入名称")
    private String name; //收入名称

//    @ManyToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "account_type", referencedColumnName = "id",nullable = false)
//    @Comment("记账类型")
//    private Enumeration accountType;  //记账类型(accountType)(AT_notBilled:不记账；AT_redPackets：红包)

    @Column(name = "valid", nullable = false, columnDefinition = "number(1,0) default 0")
    @Comment("有效")
    private boolean valid = false; //有效

    @Column(name = "required",nullable = false,columnDefinition = "number(1,0) default 0")
    @Comment("会员必填")
    private boolean required = false;//是否会员必填

    @Column(name = "note")
    @Comment("备注")
    private String note;//备注
}
